<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>排片时间的选择</title>
    <%@ include file="../comm.jsp" %>
</head>
<style>
    .box{
        float: left;
        margin-left: 10px;
        margin-top: 10px;
        width: 150px;
        height: 40px;
        line-height: 40px;
        border: solid 3px black;
        border-radius: 15px;
    }
</style>
<body>
<h2 align="center" style="margin-bottom:20px;">排片时间</h2>
<table class="layui-table" style="text-align: center">
    <tr>
        <td>年份：<strong id="year"></strong></td>
    </tr>
    <tr>
        <td id="time">
        </td>
    </tr>
</table>
<script>
    let $;
    layui.use(['jquery'], function() {
        $ = layui.$;
        let date = new Date();
        date = date.setMonth(date.getMonth()+1);
        date = new Date(date);
        let dateYear = date.getFullYear();             //获取年
        $('#year').text(dateYear);
        for(let i=0;i<20;i++){
            let dateMonth = date.getMonth().toString().padStart(2,'0');               //获取月
            let dateDate = date.getDate().toString().padStart(2,'0');                 //获取当日
            let dateDay = date.getDay();                   //获取当日星期数
            let time = dateMonth+'月'+dateDate+'日--'+'星期'+dateDay;
            let val = dateYear+'-'+dateMonth+'-'+dateDate;
            $('#time').append(' <div class="box"><a href="toPlay?valTime='+val+'" class="time">'+time+'</a></div>')
            date = date.setDate(date.getDate()+1);      //时间加一
            date = new Date(date);
        }
    });
</script>
</body>
</html>
